<!DOCTYPE html>
<html class="fyf">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>叨逼叨-你说叨啥就叨啥;叨出你的精彩;叨出你的人生;叨出你喜怒哀乐...</title>
    <link rel="stylesheet" type="text/css" href="/css/index/index.css">
</head>
<body>

	<% include include/nav.ejs %>

    <div class="w1000">
    	<div class="float-left user-word">
    		<div class="item-list" id="jTextarea">
				<div class="img">
	    			<img class="user-image" src="/img/userimg.jpg">
	    		</div>
	    		<div class="word overflow-hidden">
	    			<i class="iconfont">&#xe609;</i>
	    			<div class="txt-title">ceo</div>
	    			<div class="txt-bd">
	    				<textarea Placeholder="来吧，叨逼叨一下!" id="wordText"></textarea>
					</div>
					<div class="txt-ft">
						<button id="setWord">叨一下</button>
					</div>
	    		</div>
	    		<% if(!session.user_id){ %>
	    		<div class="txt-mast">
	    			登录后叨逼叨，<a href="/login">点击登录</a>
	    		</div>
	    		<%}%>
	    	</div>
    		<% for(var i=0; i<data.length; i++) { %>
	    		<div class="item-list">
					<div class="img">
		    			<img class="user-image" src="/img/userimg.jpg">
		    		</div>
		    		<div class="word overflow-hidden">
		    			<i class="iconfont">&#xe609;</i>
		    			<% if(data[i].userName){ %>
		    			<div class="hd"><%= data[i].userName%></div>
		    			<% }%>
		    			<div class="bd">
		    				<%= data[i].word%>
						</div>
						<div class="ft overflow-hidden">
							<ul class="float-right">
								<li>分享</li>
								<li>评论(<%= data[i].commentNumber || 0 %>)</li>
							</ul>
						</div>
		    		</div>
	    		</div>
    		<% } %>
    		<ul class="page">
    			<% var countpage = Math.ceil(PageCount/number) %>
				<% if(page != 1){ %>
    			<li><a href="/?page=<%=page-1%>" class="num page-saver">上一页</a></li>
    			<%}%>
    			<% function setpage(num){ %>
    				<% for(var i = 1; i <= num; i++) { %>
	    				<li> 
	    					<% if(i == page){ %>
	    					 <span class="active"><%= i%> </span>
	    					<%}else{%>
	    					<a href="/?page=<%=i%>" class="num"><%= i%> </a>
	    					<%}%>
	    				</li>
					<%}%>
    			<%} %>
    			<%if(countpage <= 10){%>
    				<% setpage(10) %>
    			<%}else{%>
    				<%if(page <= 4){%>
    					<% setpage(5) %>
    					<li><b>...</b></li>
    					<li><a href="/?page=<%=countpage%>" class="num"><%= countpage%></a></li>
    				<%}else if(page >= countpage - 3){%>
    					<li><a href="/?page=1" class="num"><%= 1%></a></li>
    					<li><b>...</b></li>
    					<% for(var i = countpage - 4; i <= countpage; i++) { %>
		    				<li> 
		    					<% if(i == page){ %>
		    					 <span class="active"><%= i%> </span>
		    					<%}else{%>
		    					<a href="/?page=<%=i%>" class="num"><%= i%> </a>
		    					<%}%>
		    				</li>
						<%}%>
    				<%}else{%>
    					<li><a href="/?page=1" class="num"><%= 1%></a></li>
    					<li><b>...</b></li>
    					<% for(var i = page - 2; i <= page + 2; i++) { %>
		    				<li> 
		    					<% if(i == page){ %>
		    					 <span class="active"><%= i%> </span>
		    					<%}else{%>
		    					<a href="/?page=<%=i%>" class="num"><%= i%> </a>
		    					<%}%>
		    				</li>
						<%}%>
    					<li><b>...</b></li>
    					<li><a href="/?page=<%=countpage%>" class="num"><%= countpage%></a></li>
    				<%}%>

    			<%}%>
				<% if(page != countpage){ %>
    			<li><a href="/?page=<%=page+1%>" class="num page-saver">下一页</a></li>
    			<%}%>
    		</ul>
    	</div>
    	<div class="float-right user-msg">
    		
    		<div class="gg">

    		</div>

    		<div class="gg">

    		</div>

    		<div class="gg">

    		</div>

    		<div class="gg">
    		</div>
    	</div>
    </div>
    
    <% include include/ft.ejs %>
    <script>
		require(['conf/index/index']);
    </script>
</body>
</html>